home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1626 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.2 KB

  1. Path: news.infi.net!usenet
  2. From: nngis@norfolk.infi.net (Greg DiGiorgio)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Hidding the cursor
  5. Date: 14 Jan 1996 23:50:14 GMT
  6. Organization: Customer of InfiNet
  7. Message-ID: <4dc4rm$13m@news.infi.net>
  8. References: <4d71rq$22e@alpha.delta.edu>
  9. NNTP-Posting-Host: h-langoliers.norfolk.infi.net
  10. Mime-Version: 1.0
  11. X-Newsreader: WinVN 0.99.3
  12.  
  13. In article <4d71rq$22e@alpha.delta.edu>, mcgiddin@alpha.delta.edu says...
  14. >
  15. >  Could someone help me out, or at least point me in the right direction 
  16. >here.  I'm trying to hide the cursor in a small program that I'm 
  17. writing, 
  18. >but I cannot figure out how to do it using ANSI C code.  
  19.  
  20. *** You can't hide the cursor using ANSI 'C'. You have to resort to 
  21. *** platform specific code to do that, sorry. Here's the solution in 
  22. *** MS-DOS assembler. You can port it to MS-C or Borland-C using their
  23. *** "int86" routine".
  24.  
  25. ;************************************************************************
  26. ****
  27. ;Function   Header Example        Description
  28. ;---------- -----------------------    
  29. -------------------------------------
  30. ;_O_cursor   void O_cursor(int flag)    Hide Cursor -> flag=0
  31. ;                    Show Cursor -> flag<>0
  32. ;
  33. ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  34. !!!
  35. ; All functions are FAR. As such, the first operand is 6 off of SP, not
  36. ; 4 as in a near call. For debugging, I periodically set BH=0x2b (43d) 
  37. and
  38. ; then do a conditional break in CODEVIEW when BH reg == 0x2b, then
  39. ; single step thru to look at values - GFD 052392
  40. ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  41. !!!
  42.  
  43.  
  44. ;.MODEL MEDIUM
  45. _TEXT    segment word public 'CODE'
  46.     assume CS:_TEXT
  47.     
  48.  
  49. ;.DATA    
  50.     public _O_cursor
  51.  
  52. ;------------------------------------------------------------------------
  53. -
  54. ;----------------------------- _O_cursor 
  55. ---------------------------------
  56. ;             INT 10H, service 01H                
  57. ;            --------------------
  58. ;CH = Top scan line where: Bits 7-6 = 00H
  59. ;                      5 = disable cursor
  60. ;                4-0 = Top scan line
  61. ;CL = Bottom scan line   : Bits   7 = Undefined
  62. ;                    6-5 = Show cursor
  63. ;                4-0 - lower scan line
  64. ;
  65. ; Default settings: CGA     : CH=6, CL=7
  66. ;            MDA/EGA : CH=11, CL=12
  67. ;            MCGA/VGA: CH=13, CL=14
  68. ;------------------------------------------------------------------------
  69. -
  70. _O_cursor proc far
  71.     push    bp        ;Save base pointer since I change it
  72.     mov    bp,sp        ;Get the stack pointer to get at parms
  73.     push    si
  74.     push    di
  75. ;    mov    bh,2bh        ;43 - DEBUG in codeview
  76.     mov    cx,0
  77.     mov    cx,[bp+6]    ;get the flag
  78.     cmp    cx,0000h    ;
  79.     je    INVIS        ;If (Invisible cursor)...
  80.     jmp    NORMAL        ;else /* Normal cursor */
  81. INVIS    LABEL    FAR
  82.     mov    ch,20H        ;Enable bit 5
  83.     mov    cl,00h
  84.     jmp    ENDCUR
  85. NORMAL    LABEL    FAR
  86.     mov    ch,6        ;Use CGA dflt
  87.     mov    cl,7        ;Use CGA dflt and enable cursor
  88.     jmp    ENDCUR
  89. ENDCUR    LABEL    FAR
  90.     mov    ah,01h        ;Set Text Mode Cursor Size service
  91.     int    10H        ;BIOS video interrupt
  92.     pop    di        ;Restore pushed parms
  93.     pop    si
  94.     pop    bp
  95.     ret            
  96. _O_cursor endp
  97.  
  98. >
  99. >-- 
  100. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  101. =-=-
  102. > * Matt Giddings                 Internet:  mcgiddin@alpha.delta.edu    
  103.      *
  104. > * ELeCTrO-ZiNE BBS              Fidonet :  1:249/500  BBS/FAX 
  105. (517)672-4655 *
  106. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  107. =-=-
  108.  
  109. Regards,
  110. Greg DiGiorgio
  111.  
  112.